﻿function ClientAddNewDrugCrimeResetAllField() {
    document.getElementById("drcfullname").value = '';
    $("#drcrbtmale").attr('checked', true);
    document.getElementById("drcbirthdate").value = '';
    document.getElementById("drcnoisinh").value = '';
    document.getElementById("drcCMT").value = '';
    document.getElementById("drcngaycap").value = '';
    document.getElementById("drcnoicap").value = '';
    document.getElementById("drcnguyenquan").value = '';
    document.getElementById("drcchoohn").value = '';
    document.getElementById("drctendaithe").value = '';
    document.getElementById("drcnoidk").value = '';
    document.getElementById("drctinhhinh").value = '';
    document.getElementById("drctongiao").value = '';    
    document.getElementById("drccheckdangvien").checked = false;
    document.getElementById("drcchecktienan").checked = false;
    document.getElementById("drccheckxuphat").checked = false;
    //    right col
    $("#drcrbtkinh").attr('checked', true);
    $("#drcvietnam").attr('checked', true);
    document.getElementById("drcdangvien").checked = false;
    document.getElementById("drcthanhphan").selectedIndex = 0;
    document.getElementById("drcvieclam").selectedIndex = 0;
    document.getElementById("drcbienphap").selectedIndex = 0;
    $("#drcchuacainghien").attr('checked', true);
    $("#drctainoicutru").attr('checked', true);
    document.getElementById("drchotrosaucn").selectedIndex = 0;
    document.getElementById("drcbatdaunghien").value = '';
    document.getElementById("drcloaimtsd").selectedIndex = 0;
    document.getElementById("drcfullname").focus();
}
function JumpPageAlbumList(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.FListAlbum.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divAlbumImagesList").innerHTML = retValue;
}
function JumpPageAlbumListDetails(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.AlbumDetails.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divViewAlbumListContent").innerHTML = retValue;
}
function JumpPageVideoDetail(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
   retValue = SODC.CMPortal.FVideo.FListVideo.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divVideoContentListDetail").innerHTML = retValue;
}
function ClientAddNewDrugCrimeResetAllField() {
    document.getElementById("drcfullname").value = '';
    $("#drcrbtmale").attr('checked', true);
    document.getElementById("drcbirthdate").value = '';
    document.getElementById("drcnoisinh").value = '';
    document.getElementById("drcCMT").value = '';
    document.getElementById("drcngaycap").value = '';
    document.getElementById("drcnoicap").value = '';
    document.getElementById("drcnguyenquan").value = '';
    document.getElementById("drcchoohn").value = '';
    document.getElementById("drctendaithe").value = '';
    document.getElementById("drcnoidk").value = '';
    document.getElementById("drctinhhinh").value = '';
    document.getElementById("drctongiao").value = '';    
    document.getElementById("drccheckdangvien").checked = false;
    document.getElementById("drcchecktienan").checked = false;
    document.getElementById("drccheckxuphat").checked = false;
    //    right col
    $("#drcrbtkinh").attr('checked', true);
    $("#drcvietnam").attr('checked', true);
    document.getElementById("drcdangvien").checked = false;
    document.getElementById("drcthanhphan").selectedIndex = 0;
    document.getElementById("drcvieclam").selectedIndex = 0;
    document.getElementById("drcbienphap").selectedIndex = 0;
    $("#drcchuacainghien").attr('checked', true);
    $("#drctainoicutru").attr('checked', true);
    document.getElementById("drchotrosaucn").selectedIndex = 0;
    document.getElementById("drcbatdaunghien").value = '';
    document.getElementById("drcloaimtsd").selectedIndex = 0;
    document.getElementById("drcfullname").focus();
}
function JumpPageAlbumList(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.FListAlbum.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divAlbumImagesList").innerHTML = retValue;
}
function JumpPageAlbumListDetails(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.AlbumDetails.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divViewAlbumListContent").innerHTML = retValue;
}
function JumpPageVideoDetail(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
   retValue = SODC.CMPortal.FVideo.FListVideo.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divVideoContentListDetail").innerHTML = retValue;
}
function ClientAddNewDrugCrimeResetAllField() {
    document.getElementById("drcfullname").value = '';
    $("#drcrbtmale").attr('checked', true);
    document.getElementById("drcbirthdate").value = '';
    document.getElementById("drcnoisinh").value = '';
    document.getElementById("drcCMT").value = '';
    document.getElementById("drcngaycap").value = '';
    document.getElementById("drcnoicap").value = '';
    document.getElementById("drcnguyenquan").value = '';
    document.getElementById("drcchoohn").value = '';
    document.getElementById("drctendaithe").value = '';
    document.getElementById("drcnoidk").value = '';
    document.getElementById("drctinhhinh").value = '';
    document.getElementById("drctongiao").value = '';    
    document.getElementById("drccheckdangvien").checked = false;
    document.getElementById("drcchecktienan").checked = false;
    document.getElementById("drccheckxuphat").checked = false;
    //    right col
    $("#drcrbtkinh").attr('checked', true);
    $("#drcvietnam").attr('checked', true);
    document.getElementById("drcdangvien").checked = false;
    document.getElementById("drcthanhphan").selectedIndex = 0;
    document.getElementById("drcvieclam").selectedIndex = 0;
    document.getElementById("drcbienphap").selectedIndex = 0;
    $("#drcchuacainghien").attr('checked', true);
    $("#drctainoicutru").attr('checked', true);
    document.getElementById("drchotrosaucn").selectedIndex = 0;
    document.getElementById("drcbatdaunghien").value = '';
    document.getElementById("drcloaimtsd").selectedIndex = 0;
    document.getElementById("drcfullname").focus();
}
function JumpPageAlbumList(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.FListAlbum.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divAlbumImagesList").innerHTML = retValue;
}
function JumpPageAlbumListDetails(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.AlbumDetails.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divViewAlbumListContent").innerHTML = retValue;
}
function JumpPageVideoDetail(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
   retValue = SODC.CMPortal.FVideo.FListVideo.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divVideoContentListDetail").innerHTML = retValue;
}
function ClientAddNewDrugCrimeResetAllField() {
    document.getElementById("drcfullname").value = '';
    $("#drcrbtmale").attr('checked', true);
    document.getElementById("drcbirthdate").value = '';
    document.getElementById("drcnoisinh").value = '';
    document.getElementById("drcCMT").value = '';
    document.getElementById("drcngaycap").value = '';
    document.getElementById("drcnoicap").value = '';
    document.getElementById("drcnguyenquan").value = '';
    document.getElementById("drcchoohn").value = '';
    document.getElementById("drctendaithe").value = '';
    document.getElementById("drcnoidk").value = '';
    document.getElementById("drctinhhinh").value = '';
    document.getElementById("drctongiao").value = '';    
    document.getElementById("drccheckdangvien").checked = false;
    document.getElementById("drcchecktienan").checked = false;
    document.getElementById("drccheckxuphat").checked = false;
    //    right col
    $("#drcrbtkinh").attr('checked', true);
    $("#drcvietnam").attr('checked', true);
    document.getElementById("drcdangvien").checked = false;
    document.getElementById("drcthanhphan").selectedIndex = 0;
    document.getElementById("drcvieclam").selectedIndex = 0;
    document.getElementById("drcbienphap").selectedIndex = 0;
    $("#drcchuacainghien").attr('checked', true);
    $("#drctainoicutru").attr('checked', true);
    document.getElementById("drchotrosaucn").selectedIndex = 0;
    document.getElementById("drcbatdaunghien").value = '';
    document.getElementById("drcloaimtsd").selectedIndex = 0;
    document.getElementById("drcfullname").focus();
}
function JumpPageAlbumList(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.FListAlbum.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divAlbumImagesList").innerHTML = retValue;
}
function JumpPageAlbumListDetails(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.AlbumDetails.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divViewAlbumListContent").innerHTML = retValue;
}
function JumpPageVideoDetail(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
   retValue = SODC.CMPortal.FVideo.FListVideo.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divVideoContentListDetail").innerHTML = retValue;
}
var ActiveIndex=0;

function ClientAddVote()
{
    Url=SharepointPortal.WebParts.Vote.Vote.GetAddNewUrl().value;
    window.showModalDialog(Url, "", "dialogHeight: 600px; dialogWidth: 700px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;"); 
    value=SharepointPortal.WebParts.Vote.Vote.GetHtml().value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divVoteMain").innerHTML=value;
    }
}

function ClientSaveAddVote()
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    VoteItems=SharepointPortal.WebParts.Vote.AddVote.GetVoteItemsObject().value;
    for(var Index=0;Index<VoteItems.length;Index++)
    {
        VoteItems[Index].VoteItemName=document.getElementById("txtItemName_"+Index.toString()).value;
        VoteItems[Index].IndexOrder=Index+1;
    }
    retValue = SharepointPortal.WebParts.Vote.AddVote.ServerSideAddVote(language,null,Subject,VoteItems).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
    window.close();
}


function ClientDeleteVote(VoteId)
{
    Msg=SharepointPortal.WebParts.Vote.Vote.GetConfirmDeleteMsg().value;
    if(confirm(Msg)==false)return;
    RetValue = SharepointPortal.WebParts.Vote.Vote.ServerSideDeleteVote(VoteId).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    
    value=SharepointPortal.WebParts.Vote.Vote.GetHtml().value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divVoteMain").innerHTML=value;
    }
}

function ShowClientUpdateUrlForm(VoteId)
{
    Url=SharepointPortal.WebParts.Vote.Vote.GetShowUpdateForm(VoteId).value;
    if(Url.indexOf("ERROR")!=-1)
    {
        alert(Url);
        return;
    }
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 700px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    value=SharepointPortal.WebParts.Vote.Vote.GetHtml().value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divVoteMain").innerHTML=value;
    }
}

function ShowFormAppendLink(VoteId)
{
    Url=SharepointPortal.WebParts.Vote.UpdateVote.GetShowAppendForm(VoteId).value;
    if(Url.indexOf("ERROR")!=-1)
    {
        alert(Url);
        return;
    }
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 700px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    
    value=SharepointPortal.WebParts.Vote.UpdateVote.GetHtml(language,VoteId).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divFormContent").innerHTML=value;
    }
}

function ClientSaveUpdateVote(VoteId)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    Subject=document.getElementById("txtVote").value;
    VoteItems=SharepointPortal.WebParts.Vote.UpdateVote.GetVoteItemsObject().value;
    for(var Index=0;Index<VoteItems.length;Index++)
    {
        if(document.getElementById("txtItemName_"+Index.toString())!=null)
        {
            if(document.getElementById("txtVoteItemId_"+Index.toString())!=null)
            {
                VoteItems[Index].VoteItemId=document.getElementById("txtVoteItemId_"+Index.toString()).value;
            }
            VoteItems[Index].VoteItemName=document.getElementById("txtItemName_"+Index.toString()).value;
            VoteItems[Index].IndexOrder=document.getElementById("txtIndexOrder_"+Index.toString()).value;
        }
    }
    RetValue = SharepointPortal.WebParts.Vote.UpdateVote.ServerSideUpdateVote(language,VoteId,Subject,VoteItems).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    //window.close();
}

function AppendNewRow()
{
    document.getElementById("divContentItems").innerHTML= document.getElementById("divContentItems").innerHTML+SharepointPortal.WebParts.Vote.AddVote.ServerSideNewLinkItem(ActiveIndex).value;
    ActiveIndex++;
    alert(ActiveIndex);
}

function RemoveItem(Index)
{
    document.getElementById("divRowItem_"+Index).innerHTML="";
    Html=document.getElementById("divContentItems").innerHTML;
    document.getElementById("divContentItems").innerHTML=SharepointPortal.WebParts.Vote.AddVote.ProcessHtml(Html,Index).value;
}


function DetectLanguageBody(VoteId)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    value=SharepointPortal.WebParts.Vote.UpdateVote.GetHtml(language,VoteId).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    else
    {
        document.getElementById("divFormContent").innerHTML=value;
    }
    
    value=SharepointPortal.WebParts.Vote.UpdateVote.GetQuestion(language,VoteId).value;
     if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    else
    {
        document.getElementById("txtVote").value=value;
    }
}
function ClientAddNewDrugCrimeResetAllField() {
    document.getElementById("drcfullname").value = '';
    $("#drcrbtmale").attr('checked', true);
    document.getElementById("drcbirthdate").value = '';
    document.getElementById("drcnoisinh").value = '';
    document.getElementById("drcCMT").value = '';
    document.getElementById("drcngaycap").value = '';
    document.getElementById("drcnoicap").value = '';
    document.getElementById("drcnguyenquan").value = '';
    document.getElementById("drcchoohn").value = '';
    document.getElementById("drctendaithe").value = '';
    document.getElementById("drcnoidk").value = '';
    document.getElementById("drctinhhinh").value = '';
    document.getElementById("drctongiao").value = '';    
    document.getElementById("drccheckdangvien").checked = false;
    document.getElementById("drcchecktienan").checked = false;
    document.getElementById("drccheckxuphat").checked = false;
    //    right col
    $("#drcrbtkinh").attr('checked', true);
    $("#drcvietnam").attr('checked', true);
    document.getElementById("drcdangvien").checked = false;
    document.getElementById("drcthanhphan").selectedIndex = 0;
    document.getElementById("drcvieclam").selectedIndex = 0;
    document.getElementById("drcbienphap").selectedIndex = 0;
    $("#drcchuacainghien").attr('checked', true);
    $("#drctainoicutru").attr('checked', true);
    document.getElementById("drchotrosaucn").selectedIndex = 0;
    document.getElementById("drcbatdaunghien").value = '';
    document.getElementById("drcloaimtsd").selectedIndex = 0;
    document.getElementById("drcfullname").focus();
}
function JumpPageAlbumList(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.FListAlbum.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divAlbumImagesList").innerHTML = retValue;
}
function JumpPageAlbumListDetails(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.AlbumDetails.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divViewAlbumListContent").innerHTML = retValue;
}
function JumpPageVideoDetail(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
   retValue = SODC.CMPortal.FVideo.FListVideo.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divVideoContentListDetail").innerHTML = retValue;
}
function ClientAddNewDrugCrimeResetAllField() {
    document.getElementById("drcfullname").value = '';
    $("#drcrbtmale").attr('checked', true);
    document.getElementById("drcbirthdate").value = '';
    document.getElementById("drcnoisinh").value = '';
    document.getElementById("drcCMT").value = '';
    document.getElementById("drcngaycap").value = '';
    document.getElementById("drcnoicap").value = '';
    document.getElementById("drcnguyenquan").value = '';
    document.getElementById("drcchoohn").value = '';
    document.getElementById("drctendaithe").value = '';
    document.getElementById("drcnoidk").value = '';
    document.getElementById("drctinhhinh").value = '';
    document.getElementById("drctongiao").value = '';    
    document.getElementById("drccheckdangvien").checked = false;
    document.getElementById("drcchecktienan").checked = false;
    document.getElementById("drccheckxuphat").checked = false;
    //    right col
    $("#drcrbtkinh").attr('checked', true);
    $("#drcvietnam").attr('checked', true);
    document.getElementById("drcdangvien").checked = false;
    document.getElementById("drcthanhphan").selectedIndex = 0;
    document.getElementById("drcvieclam").selectedIndex = 0;
    document.getElementById("drcbienphap").selectedIndex = 0;
    $("#drcchuacainghien").attr('checked', true);
    $("#drctainoicutru").attr('checked', true);
    document.getElementById("drchotrosaucn").selectedIndex = 0;
    document.getElementById("drcbatdaunghien").value = '';
    document.getElementById("drcloaimtsd").selectedIndex = 0;
    document.getElementById("drcfullname").focus();
}
function JumpPageAlbumList(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.FListAlbum.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divAlbumImagesList").innerHTML = retValue;
}
function JumpPageAlbumListDetails(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.AlbumDetails.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divViewAlbumListContent").innerHTML = retValue;
}
function JumpPageVideoDetail(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
   retValue = SODC.CMPortal.FVideo.FListVideo.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divVideoContentListDetail").innerHTML = retValue;
}
function ClientAddHtml()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Html.Html.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Html.Html.GetHtml(WorkflowStatus,PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHtmlContent").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHtml()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language = document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    Alias = document.getElementById("txtAlias").value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Html.AddHtml.ServerSideAddHtml(belongSite, language, Alias, Subject, bodyText).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHtml(HtmlId)
{
    language = document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    Alias = document.getElementById("txtAlias").value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Html.UpdateHtml.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Html.UpdateHtml.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Html.UpdateHtml.ServerSideHtml(language, HtmlId, Alias, Subject, bodyText).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Html.UpdateHtml.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Html.Html.GetProcessingText().value;
    setTimeout("RealRunFilter()",10);
}


function RealRunFilter()
{
    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
    WorkflowStatus="";
    if(WorkflowStatusIndex!=-1)
    {
        WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    }
    
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Html.Html.GetHtml(belongSite, WorkflowStatus,PageIndex).value;
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHtmlContent").innerHTML=value;
}


function ClientDeleteHtml(HtmlId)
{
    if(confirm(SharepointPortal.WebParts.Html.Html.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Html.Html.ServerSideDeleteHtml(HtmlId).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Html.Html.GetDeleteOkMsg().value);
    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Html.Html.GetHtml(WorkflowStatus,PageIndex).value;
    document.getElementById("divHtmlContent").innerHTML=value;
}

function ShowUpdateHtmlForm(HtmlId)
{
    Url=SharepointPortal.WebParts.Html.Html.GetUpdateHtmlUrl(HtmlId).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
 
    value=SharepointPortal.WebParts.Html.Html.GetHtml(WorkflowStatus,PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHtmlContent").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHtmlBody(HtmlId)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Html.UpdateHtml.GetSubject(language,HtmlId).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Html.UpdateHtml.GetBody(language,HtmlId).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHTML(retValue);
    
}


function ClientPublishingHtml(HtmlId)
{
    if(confirm(SharepointPortal.WebParts.Html.Html.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Html.Html.ServerSidePublishing(HtmlId).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHtml(HtmlId)
{
    if(confirm(SharepointPortal.WebParts.Html.Html.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Html.Html.ServerSideUnPublishing(HtmlId).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Html.Html.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Html.Html.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Html.Html.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
